package com.storlead.email;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import java.util.Properties;

/**
 * @Author: Timo
 * @Date: 2019/4/14 21:33
 * @Description: 类用途：
 */
@Configuration
public class EmailConfig {

//    @Bean("javaMailSenderGmail")
//    public JavaMailSender javaMailSenderGmail() {
//        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
//        mailSender.setHost("smtp.gmail.com");
//        mailSender.setPort(465);
//        mailSender.setUsername("jixiangyun1991@gmail.com");
//        mailSender.setPassword("jxy19910320");
//        Properties props = mailSender.getJavaMailProperties();
//        props.put("mail.transport.protocol", "smtp");
//        props.put("mail.smtp.auth", "true");
//        props.put("mail.smtp.starttls.enable", "true");
//        props.put("mail.debug", "true");
//        return mailSender;
//    }

    /**
     * spring.mail.host=smtp.qq.com
     * spring.mail.username=用户名
     * spring.mail.password=密码
     * spring.mail.properties.mail.smtp.auth=true
     * spring.mail.properties.mail.smtp.starttls.enable=true
     * spring.mail.properties.mail.smtp.starttls.required=true
     * @return
     */


//    @Bean("javaMailSenderQQ")
//    public JavaMailSender javaMailSenderQQ() {
//        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
//        mailSender.setHost("smtp.qq.com");
////        mailSender.setPort(465);
//        mailSender.setUsername("1002512666@qq.com");
//        mailSender.setPassword("gshjwpkyfwkgbddg");
//        Properties props = mailSender.getJavaMailProperties();
//        props.put("mail.transport.protocol", "smtp");
//        props.put("mail.smtp.auth", "true");
//        props.put("mail.smtp.starttls.enable", "true");
//        props.put("mail.smtp.starttls.required", "true");
//        return mailSender;
//    }
}
